<?php
include 'test_header.php';

class test_class_reply_process extends UnitTestCase{
	
	private $db ; 

	function setUp(){

		$this->db = db_connect();

		$sql = "
CREATE TABLE IF NOT EXISTS `reply` (
  `reply_no` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `topic_no` bigint(20) NOT NULL,
  `content` text NOT NULL,
  `reply_username` varchar(256) NOT NULL,
  `reply_time` datetime NOT NULL,
  UNIQUE KEY `reply_no` (`reply_no`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
";

		$res = $this->db->query( $sql );
	}

	function tearDown(){
		
		$sql = "drop table reply";

		$res = $this->db->query( $sql );
	
	}

	function test_save_user_reply(){

		$request = array( 'content'=>'test' , 'topic_no'=>'0' );
		$reply_process = new reply_process( $this->db , $request );
		$reply_process->set_reply_username( 'tester' );

		$this->assertTrue( $reply_process->save() );
	}
	function test_topic_reply_count_will_plus_with_user_reply(){
	/*
		$request = array( 'content'=>'test', 'topic_no'=>'0' );
		$reply_process = new reply_process( $this->db , $request );
		$reply_process->set_reply_username( 'tester' );

		$this->assertTrue( $reply_process->save() );
		
		$topic_no = '1';
		$topic_process = new topic_process( $this->db );
		$topic_process->load( 'topic_no' , $topic_no );

		$this->assertTrue( $topic_process->plus_reply_count() );
		$topic_process->save();
	 */
	}
}
	

$test = new test_class_reply_process();
$test->run( new HtmlReporter() );

